package org.RSG.Interface;

import javax.swing.*;
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.InternalFrameListener;

import org.RSG.Application.*;

import java.awt.*;

public class ImageWindow implements InternalFrameListener
{
	public JInternalFrame window;
	public ImagePanel ImagePanel;
	public int width;
	public int height;
	public ImageWindow(int w, int h, String caption)
	{
		Application.inFocus = this;
		Application.IMGN++;
		this.width = (w/10);
		this.height = (h/10);
		this.window = new JInternalFrame(caption, false, true, false, false);
		this.window.setPreferredSize(new Dimension(w, h));
		this.ImagePanel = new ImagePanel(w, h);
		this.window.add(this.ImagePanel);
		this.window.addInternalFrameListener(this);
		this.window.pack();
		this.window.setVisible(true);
		this.window.setLocation(new Point(150, 25));
		//Correct Internal Size
		Insets insets = this.window.getInsets();
		this.window.setSize(new Dimension(this.window.getWidth() + insets.left + insets.right, this.window.getHeight() + insets.top + insets.bottom + 23)); //Titlebar Hardcoded Size Fix TEMP

	}
	@Override
	public void internalFrameActivated(InternalFrameEvent e) {
		Application.inFocus = this;
		System.out.println("Focus Gained: " + Application.inFocus.toString());
	}
	@Override
	public void internalFrameClosed(InternalFrameEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void internalFrameClosing(InternalFrameEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void internalFrameDeactivated(InternalFrameEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void internalFrameDeiconified(InternalFrameEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void internalFrameIconified(InternalFrameEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void internalFrameOpened(InternalFrameEvent arg0) {
		// TODO Auto-generated method stub
		
	}
}